/**************************************************************************
** Yabet is bloging editor tool that supports many blog's formats. It is very usefull for crossposting, allows easily to
** make posts to your blogs.
**
** Copyright (C) 2010 Valery Konchin <eeexception@gmail.com>
**
** This program is free software: you can redistribute it and/or modify
**     it under the terms of the GNU General Public License as published by
**     the Free Software Foundation, either version 3 of the License, or
**     (at your option) any later version.
**
**     This program is distributed in the hope that it will be useful,
**     but WITHOUT ANY WARRANTY; without even the implied warranty of
**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**     GNU General Public License for more details.
**
**     You should have received a copy of the GNU General Public License
**     along with this program.  If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/

#include "defaulthtmlyabettextmarkup.h"

DefaultHtmlYabetTextMarkup::DefaultHtmlYabetTextMarkup()
{
    markupElements.insert(YabetTextMarkup::BOLD_ELEMENT_NAME, new YabetTextMarkupElement("<b>%1</b>"));
    markupElements.insert(YabetTextMarkup::ITALIC_ELEMENT_NAME, new YabetTextMarkupElement("<i>%1</i>"));
    markupElements.insert(YabetTextMarkup::CODE_ELEMENT_NAME, new YabetTextMarkupElement("<code>%1</code>"));
    markupElements.insert(YabetTextMarkup::LINK_ELEMENT_NAME, new YabetTextMarkupElement("<a href=\"%1\">%2</a>"));
    markupElements.insert(YabetTextMarkup::IMAGE_ELEMENT_NAME, new YabetTextMarkupElement("<img src=\"%1\" />"));
    markupElements.insert(YabetTextMarkup::TEXT_CUT_ELEMENT_NAME, new YabetTextMarkupElement("<!--text break-->"));
    markupElements.insert(YabetTextMarkup::VIDEO_ELEMENT_NAME, new YabetTextMarkupElement(""));
    markupElements.insert(YabetTextMarkup::LINE_BREAK_ELEMENT_NAME, new YabetTextMarkupElement("<br/>"));
    markupElements.insert(YabetTextMarkup::LIST_ELEMENT_NAME, new YabetTextMarkupElement("<ul>%1<li>%2</li>%3</ul>"));
    markupElements.insert(YabetTextMarkup::USER_ELEMENT_NAME, new YabetTextMarkupElement("<!--user-->%1<!--/user-->"));
    markupElements.insert(YabetTextMarkup::QUOTE_ELEMENT_NAME, new YabetTextMarkupElement("<blockquote>%1</blockquote>"));
    markupElements.insert(YabetTextMarkup::PARAGRAPH_ELEMENT_NAME, new YabetTextMarkupElement("<p>%1</p>"));
    markupElements.insert(YabetTextMarkup::PRE_ELEMENT_NAME, new YabetTextMarkupElement("<pre>%1</pre>"));
    markupElements.insert(YabetTextMarkup::FONT_ELEMENT_NAME, new YabetTextMarkupElement("<font color=\"%1\">%2</font>"));

}

QString DefaultHtmlYabetTextMarkup::getConfigVersion() {
    return YabetTextMarkup::PROPERTIES_FILE_VERSION;
}

QString DefaultHtmlYabetTextMarkup::getMarkupName() {
    return "default_html";
}

YabetTextMarkupElement* DefaultHtmlYabetTextMarkup::getMarkupElement(QString markupElementName) {
    return markupElements.value(markupElementName, new YabetTextMarkupElement(""));
}

QStringList DefaultHtmlYabetTextMarkup::getMarkupElementsNames() {
    return QStringList(markupElements.keys());
}

QString DefaultHtmlYabetTextMarkup::getPostSite() {
    return "about:home";
}

QString DefaultHtmlYabetTextMarkup::getPostUrl() {
    return "about:home";
}
